package com.sctvcloud.bazhong.ui.adapter.holder;

import android.content.Context;
import android.util.Pair;
import android.view.View;

import com.ruihang.generalibrary.ui.adapter.holder.BaseRecylerHolder;
import com.sctvcloud.bazhong.base.BaseActivity;
import com.sctvcloud.bazhong.base.BaseFragment;
import com.sctvcloud.bazhong.ui.util.IListShowData;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/7/4.
 */

public abstract class BaseAbsHolder<T extends IListShowData> extends BaseRecylerHolder<T> {

    public static final int ITEMMODE_FIRST = -10;
    public static final int ITEMMODE_LAST = -11;
    public static final int ITEMMODE_SINGLE = -12;
    public static final int ITEMMODE_NORMAL = 0;
    protected BaseAbsHolder.OnImageClickListener listener;
    protected String anchorId;
    protected BaseActivity activity;
    protected BaseFragment fragment;
    protected ArrayList<Pair<String, String>> pairs;

    public void setActivity(BaseActivity activity) {
        this.activity = activity;
    }

    public void setFragment(BaseFragment fragment) {
        this.fragment = fragment;
    }

    public void setPairs(ArrayList<Pair<String, String>> pairs) {
        this.pairs = new ArrayList<>();
        if (pairs != null) {
            this.pairs.addAll(pairs);
        }

    }

    public interface OnImageClickListener {
        void onClick(String imageUrl);
    }

    public void setOnImageClickListener(OnImageClickListener listener) {
        this.listener = listener;
    }

    public BaseAbsHolder(Context context, View itemView) {
        super(context, itemView);
    }

    /**
     * 设置条目类型,可用于通知此holder是最前一个或最后一个等
     *
     * @param mode
     */
    public void setItemMode(int mode) {
    }

    public void setAnchorId(String anchorId) {
        this.anchorId = anchorId;
    }
}
